package com.lagou.edu.controller;

import com.lagou.edu.service.MailService;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.logging.Logger;

@RestController
@RequestMapping("/email")
public class EmailController {
    Log logger = LogFactory.getLog(EmailController.class);

    @Autowired
    private MailService mailService;

    @GetMapping("/{email}/{code}")
    public Boolean sendEmail(@PathVariable("email") String email, @PathVariable("code") String code) {
        return mailService.sendSimpleMail(email, "注册账号验证码", code);
    }
}
